package cn.com.lms.business.questionnaire.persistence.repository;

import cn.com.lms.business.questionnaire.persistence.entity.UserQuestionnaireTitle;

import com.bnzj.core.persistence.repository.BaseRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Author: 16266
 * @DateTime: 2020/4/2 17:18
 * @Description:
 */
@Repository
public interface UserQuestionnaireTitleRepository extends BaseRepository<UserQuestionnaireTitle,Long> {

    @Query(value = " SELECT a.plan_name, a.create_time, b.stage_name, c.user_id, e.id ,e.questionnaire_name FROM bnz_learning_plan a,bnz_learning_stage b,bnz_learning_student c,bnz_learning_stage_detail d, bnz_questionnaire_info e WHERE  a.id = b.plan_id AND b.id = c.stage_detail_id  AND c.stage_detail_id = d.id  AND d.obj_id = e.id AND d.study_type = '1' AND c.user_id = ?1",nativeQuery = true)
    List<UserQuestionnaireTitle> findUserQuestionnaireTitle(Long userId);
}
